<style>
    .form-group .required:before{
        content:'* ';
        color:red;
    }
</style>
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">



    <div class="form-group">
        <label for="c-name1" class="control-label col-xs-12 col-sm-2 required">{:__('Name_en')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name1" data-rule="required" class="form-control" name="row[name_en]" type="text" value="{$data.name_en ?? ''}" placeholder="" onblur="copyValueToAnotherInput()">

        </div>
    </div>

    <div class="form-group">
        <label for="c-name2" class="control-label col-xs-12 col-sm-2 required">{:__('Name_hk')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name2" data-rule="required" class="form-control" name="row[name_hk]" type="text" value="{$data.name_hk ?? ''}" placeholder="">

        </div>
    </div>

    <div class="form-group">
        <label for="c-name3" class="control-label col-xs-12 col-sm-2 required">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name3" data-rule="required" class="form-control" name="row[name_zh]" type="text" value="{$data.name_zh ?? ''}" placeholder="">

        </div>
    </div>

    <div class="form-group">
        <label for="c-sendpic" class="control-label col-xs-12 col-sm-2 required">{:__('Cover')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-sendpic" data-rule="" class="form-control"  size="50" name="row[thumb]" type="text" value="{$data.thumb ?? ''}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-sendpic" class="btn btn-danger faupload" data-input-id="c-sendpic" data-maxcount="5" data-maxsize="6mb" data-mimetype="jpeg,png,jpg,gif,video/*" data-multiple="false" data-preview-id="p-sendpic" data-aspect-ratio="0"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-sendpic"></span>
            </div>
            <p style="color: #8b8888">{$tips}</p>
            <ul class="row list-inline faupload-preview" id="p-sendpic">

            </ul>
        </div>
    </div>


    <div class="form-group">
        <label for="c-weigh" class="control-label col-xs-12 col-sm-2 required">{:__('Position')}:</label>
        <div class="col-xs-12 col-sm-8">
            <select name="row[position]" class="form-control selectpicker" id="bg_tag" {if $id >0} disabled {/if}>
                <option value="0">{:__('Choose')}</option>
                {foreach name="positionData" item="vo" key="k"}
                <option value="{$k}"  {if condition="(empty($data) neq true) and ($k eq $data['position'])"} selected {/if}>{$vo}</option>
                {/foreach}
            </select>

            </p>
        </div>
    </div>

    <div class="form-group fuwenben">
        <label for="content3" class="control-label col-xs-12 col-sm-2">{:__('descript_en')}：</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="content3" class="form-control" name="row[descript_en]"  data-rule="" rows="12">{$data.descript_en ?? ''}</textarea>
        </div>
    </div>
    <div class="form-group fuwenben">
        <label for="content2" class="control-label col-xs-12 col-sm-2">{:__('descript_hk')}：</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="content2" class="form-control" name="row[descript_hk]"  data-rule="" rows="12">{$data.descript_hk ?? ''}</textarea>
        </div>
    </div>
    <div class="form-group fuwenben">
        <label for="content" class="control-label col-xs-12 col-sm-2">{:__('descript')}：</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="content" class="form-control" name="row[descript_zh]"  data-rule="" rows="12">{$data.descript_zh ?? ''}</textarea>
        </div>
    </div>



    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <input type="hidden" name="row[id]" value="{$id}">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
<script>
    function copyValueToAnotherInput() {
        // 获取输入框1的值
        var input1Value = document.getElementById('c-name1').value;
        var input2Value = document.getElementById('c-name2').value;
        var input3Value = document.getElementById('c-name3').value;
        // 将输入框1的值设置到输入框2
        if(input2Value == ''){
            document.getElementById('c-name2').value = input1Value;
        }
        if(input3Value == ''){
            document.getElementById('c-name3').value = input1Value;
        }

    }
</script>
